home *** CD-ROM | disk | FTP | other *** search
/ TPUG - Toronto PET Users Group / TPUG Users Group CD / TPUG Users Group CD.iso / AMIGA / (A)TB / (A)TBE.ADF / Utility / ls.doc < prev    next >
Text File  |  1989-09-12  |  22KB  |  519 lines

  1.  
  2.      LS(1)                        AmigaOS 1.3             LS(1)
  3.  
  4.  
  5.      NAME
  6.       ls - list contents of directory
  7.  
  8.  
  9.      SYNOPSIS
  10.       ls [ [ -options <args> ] [ names ] ] ...
  11.  
  12.  
  13.      DESCRIPTION
  14.       For each directory name argument, ls lists the contents of the
  15.       directory; for each file name argument (non-wildcarded), ls
  16.       lists the entry using the long listing format.  If wildcards
  17.       (* or ?) are passed to ls, it internally expands the filespec
  18.       into a list of names, and lists them in the requested format
  19.       (short, long, or single column).
  20.  
  21.       The output is sorted alphabetically, by default, and the short
  22.       format listing is used unless the argument name is a "fully
  23.       named path" (i.e., one without wildcards), or an option flag
  24.       requests a different format.
  25.  
  26.       When no argument is given, the current directory is listed.
  27.       When several arguments are given, the arguments are processeed
  28.       in the order presented, with "non-sticky" option flags being
  29.       reset to the default value between arguments. Option flags may
  30.       preceed the individual name arguments.
  31.  
  32.       There are three major listing formats. The default format is to
  33.       list the entries in a short, columnar format, with entries
  34.       sorted down the columns. The long and single column (one entry
  35.       per line) formats are enabled with various options.
  36.  
  37.       For the short format, ls reads the size of the current window
  38.       to determine the character positions available on one line, and
  39.       the number of lines available without scrolling. If this
  40.       information cannot be obtained, ls assumes 77 columns by 23
  41.       lines. A builtin "pager" is available by default when the short
  42.       format is used.
  43.  
  44.       The output formats and applicable option switches are designed
  45.       to emulate the UNIX(R) equivalent as closely as possible.
  46.  
  47.       The options are as follows:
  48.  
  49.            -a   Lists entries including those whose names begin with
  50.             a dot (.) These are not listed by default.
  51.  
  52.            -b   Normally, the long format listing shows the total
  53.             number of blocks used by an entry (including the File
  54.             Header and Extension blocks). This option limits the
  55.             block count to the number of Data Blocks only.
  56.  
  57.            -c   Shows the comment/filenote for an entry, if any. The
  58.             comment is shown enclosed in quote marks on a line
  59.             beneath the entry. This option implies the long format
  60.             listing.
  61.  
  62.            -d   Show only entries that are directories.
  63.  
  64.            -e   By default, ls shows the "execute" attribute bit in
  65.             the long format listing as an "x". This option changes
  66.             that to an "e".  [sticky]
  67.  
  68.            -f   Show only entries that are files (i.e., not
  69.             directories).
  70.  
  71.            -h   Lists entries including those whose "hidden"
  72.             attribute bit is set. These are not listed by default.
  73.  
  74.            -i   Lists entries including those whose names end with
  75.             the string ".info". These are not listed by default.
  76.  
  77.            -k   The output listing is sorted by the disk "key" value
  78.             of the entries.  [sticky]
  79.  
  80.            -l   Lists in long format, giving the entrys' attribute
  81.             bits, comment present flag, disk key (if -k or -K
  82.             specified), size in blocks, size in bytes, date, and
  83.             name.
  84.  
  85.            -m   Lists entries with the case "mixed". Normally, the
  86.             case of entry names is respected when sorting.
  87.  
  88.            -n   No sorting of entries is performed. Entries are
  89.             listed the order in which they are Examined by the
  90.             system.
  91.  
  92.            -o   Use the old ls version (v3.1) long format when a long
  93.             listing is requested.  Note: this option does not cause
  94.             a long listing by itself, but only specifies that the
  95.             old format be used, should a long listing be requested
  96.             (see notes below).
  97.  
  98.            -p   Puts a slash (/) after each entry name if that entry
  99.             is a directory.
  100.  
  101.            -q   Normally, ls will continue to process name arguments
  102.             until the argument list is exhausted.  This option will
  103.             cause ls to terminate when an entry is not found.  (This
  104.             option only has meaning for "fully named path" args).
  105.  
  106.            -r   Reverses the sort order to get reverse alphabetic,
  107.             oldest, smallest, or highest key first as appropriate.
  108.  
  109.            -s   Sort by size, with largest first.  [sticky]
  110.  
  111.            -t   Sort by date, with newest first.  [sticky]
  112.  
  113.            -u   Display a short usage summary, showing syntax and
  114.             options.
  115.  
  116.            -v   Use variable column widths in the short format
  117.             listing. Normally, ls bases the column widths on the
  118.             longest name in the directory, and uses that value for
  119.             all columns. This option allows each column's width to be
  120.             determined by the longest name in the column itself.
  121.  
  122.            -x pat
  123.             Excludes entries matching the pattern "pat" from the
  124.             listing.  The pattern string may contain "*" and "?",
  125.             which are interpreted as wildcards with the usual
  126.             meaning.          [sticky]
  127.  
  128.            -z   Overrides the calculation of the block counts, and
  129.             shows the value found in the filesystem's NumBlocks
  130.             entry. This option is useful for getting an indication of
  131.             a file's current block size if the file is being written
  132.             to, or if the file resides on a psuedo-device (such as a
  133.             "pathass" assign) that has no inherent bytes/block value.
  134.             Note: the block count reported should only be used as an
  135.             indicator, as it may not be exact.
  136.  
  137.            -A   Lists all entries.  This option is equivalent to
  138.             using the a, h, and i options together. Note: entries
  139.             matching the exclude pattern (-x) are not listed.
  140.  
  141.            -B size
  142.             Normally, ls computes an entry's block count using the
  143.             bytes/block value appropriate for the filesystem or
  144.             device on which the entries reside (currently 512 for the
  145.             FFS, and 488 for the OFS). This option allows that value
  146.             to be specified directly, which can be useful to
  147.             determine if an entry or entries will "fit" on a device
  148.             which has a different bytes/block value. In such usage,
  149.             the "size" of the target device would be specified by the
  150.             option's argument, and the block count obtained then
  151.             compared to the number of blocks available on the target
  152.             device (with Info, for example).  [sticky]
  153.  
  154.            -C   Single column (one entry per line) output format.
  155.             Note: this usage of "-C" is exactly opposite UNIX's
  156.             usage.
  157.  
  158.            -D   Normally, files and directories are intermixed in the
  159.             output listings.  With this option, all directories will
  160.             appear seperately, and last in the listing.
  161.  
  162.            -E   Normally, ANSI escape codes are used to highlight
  163.             names of directory entries and comments. This option
  164.             disables such highlighting. Note: ANSI escape codes are
  165.             normally automatically disabled when the ls output is
  166.             redirected to stdout or is piped.  [sticky]
  167.  
  168.            -F <format>
  169.             Allows the specification of the output format when the
  170.             old long format is used.  This option implies -l and -o
  171.             (see notes below).
  172.  
  173.            -G   Disables the subdirectory-by-subdirectory summary
  174.             totals normally provided when the long format listing is
  175.             used.
  176.  
  177.            -H   Disables printing of the subdirectory name header
  178.             line normally provided for other than the current
  179.             directory.
  180.  
  181.            -I   Normally, when using the short format, if the number
  182.             of entries is larger than can be displayed in the window
  183.             ls is using, a builtin "pager" is invoked to prevent the
  184.             list from scrolling.  This option (as well as output re-
  185.             direction or pipeing) inhibits the pager.
  186.  
  187.            -K   Display disk "keys" in the long format listing.
  188.             Normally, they are not shown. This option implies the
  189.             long format.
  190.  
  191.            -Ln  Recursively lists subdirectories encountered, with
  192.             depth limited to "n" levels. A depth of n = 1 lists only
  193.             the current directory.
  194.  
  195.            -M   Ignore alphabetic case when matching directory
  196.             contents with wildcard patterns. Normally, the case of
  197.             names is respected. This option applies to both name
  198.             arguments, and exclude (-x) patterns.
  199.  
  200.            -N name
  201.             Show only entries that are newer than entry "name".
  202.             "Name" cannot be wildcarded.
  203.  
  204.            -O name
  205.             Show only entries that are older than entry "name".
  206.             "Name" cannot be wildcarded.
  207.  
  208.            -P   Show entry names as full (absolute) path names. This
  209.             option implies the long format.
  210.  
  211.            -Q   Normally, ls disables the system requesters that pop
  212.             up when a device is empty, etc, and presents an error
  213.             msg. This option turns them on again.  [sticky]
  214.  
  215.            -R   Recursively lists subdirectories encountered.
  216.  
  217.            -S   Normally, files and directories are intermixed in the
  218.             output listings.  With this option, all directories will
  219.             appear seperately, and first in the listing.
  220.  
  221.            -T   Provides a grand total of all files and directories,
  222.             and their sizes, for all entries processed. This option
  223.             is valid with all formats. Note: the seperate
  224.             totalization line will not be printed, if the information
  225.             is simply a duplication (as it would be for just a long
  226.             format list of the current directory).
  227.  
  228.            -V   Show entry names as relative (to the current
  229.             directory) path names. This option implies the long
  230.             format.
  231.  
  232.            -W   Normally, when a "wildcarded match" occurs on a
  233.             directory entry, its contents are listed. This option
  234.             prevents the contents from being listed. Only the
  235.             directory name will be printed.
  236.  
  237.            -X width
  238.             Forces the short format to use "width" for the number of
  239.             columns available in ls's window.  [sticky]
  240.  
  241.            -Y height
  242.             Forces the short format to use "height" for the number of
  243.             lines available in ls's window.  [sticky]
  244.  
  245.            -Z   Forces output of ANSI escape sequences for
  246.             highlighting, even though the ls output may be redirected
  247.             to stdout, or piped.  See also, -E.  [sticky]
  248.  
  249.            -0 thru
  250.            -6   Specifies the format to be used for the date in the
  251.             long listing (not applicable to the -o long format).
  252.             [sticky]
  253.  
  254.             Available formats are:
  255.                0: age to years:  mmm  d hh:mm  aging to  mmm dd  yyyy
  256.                1: full:      mmm dd yyyy  hh:mm:ss
  257.                2: dash alpha:    dd-mmm-yy hh:mm:ss
  258.                3: dash numeric:  mm-dd-yy hh:mm:ss
  259.                4: slash:     mm/dd/yy hh:mm:ss
  260.                5: european:  dd/mm/yy hh:mm:ss
  261.                6: dot:       yy.mm.dd hh:mm:ss
  262.  
  263.             Format 0 is the default, and is the format used by UNIX.
  264.             The "aging" period is 180 days, and the day may be either
  265.             one or two digits, as required.
  266.  
  267.            -?   Synonym for "-u".  Displays a short usage summary.
  268.  
  269.            -    Forces the next argument to be interpreted as a name.
  270.             This is useful for specifying entries whose names begin
  271.             with the "-" character.
  272.  
  273.  
  274.       The attribute bits printed in the default long format consist
  275.       of a nine character string. Each position contains a letter if
  276.       the attribute it represents is "true", or a "-" otherwise. If
  277.       all attributes were to apply to a single entry, the string
  278.       would appear as "dhsparwxd", where:
  279.          d  indicates the entry is a directory
  280.          h  indicates the entry is a hidden entry
  281.          s  indicates the entry is a script file
  282.          p  indicates the entry is a pure executable (residentable)
  283.          a  indicates the entry has been archived, and not modified
  284.             since
  285.          r  indicates the entry is readable
  286.          w  indicates the entry is writable
  287.          x  indicates the entry is executable (or "e" with the -e
  288.             option)
  289.          d  indicates the entry is deletable
  290.  
  291.       It should be noted that AmigaOS 1.3 includes only marginal
  292.     support of the attribute bits, and enforces few of them. The
  293.     above however is their formal definition. Also, "directory" is
  294.     not an attribute bit, but is included in the attribute string.
  295.     Further, a "c" flag will appear to the right of the attribute
  296.     string should an entry have an associated comment/filenote (or a
  297.     blank if not).
  298.  
  299.       AmigaOS makes provisions for additional attributes, some of
  300.     which may be application specific. Should any of these be set, ls
  301.     will display a "+" instead of a "-" in the hidden attribute
  302.     position, or an "H" if the hidden attribute itself also applies.
  303.  
  304.  
  305.       The ls -l (default long list) command prints its output as
  306.    follows:
  307.  
  308.            --sa-rw-d c   136    65383  May  5 18:15  fubar
  309.  
  310.       This horizontal configuration provides a good deal of
  311. information. From right to left, you see that the current directory
  312. holds one file, named "fubar".  It was created (or at least last
  313. modified) at 6:15 P.M. on May 5th. It contains 65,383 bytes, and
  314. occupies 136 blocks on the device where it is located (including the
  315. file header block, and any extension blocks). There is a comment
  316. associated with the file, and it is (supposedly) a script file that
  317. has been archived, and may be read, written, and deleted.
  318.  
  319.  
  320.      EXAMPLES
  321.            ls -a
  322.  
  323.       This command prints the names of all files in the current
  324.   directory, including those that begin with a dot (.), which
  325.   normally are not printed.  The short format is used.
  326.  
  327.  
  328.            ls -cAKP1
  329.  
  330.       This command provides you with a maximum amount of information
  331.   on all files in the current directory, including those that
  332.   normally do not print (A), associated comments, if any (c), the
  333.   disk key numbers (K), the full path name (P), and the full date
  334.   format (1). A long format listing is implied (both c and P).
  335.  
  336.  
  337.            ls -ARTB488
  338.  
  339.       This command prints the names of all files in the current
  340.   directory (A), and all subdirectories below it (R), with a grand
  341.   total of the counts and sizes at the end (T). Block counts are
  342.   computed as if the files were located on an OFS (Old File System)
  343.   device (B488), and the short format is used.
  344.  
  345.       If the files were actually located on an FFS (Fast File System)
  346.       device, such as a hard disk partition, comparing the grand
  347.       total of the block counts to the available blocks on an OFS
  348.       floppy (with say, Info) would tell you if the tree would fit on
  349.       the floppy.
  350.  
  351.  
  352.            ls -hrtX50 -Y 15 -Tx*zoo
  353.  
  354.       This command prints a short format listing of the current
  355. directory, including hidden files (h), sorted by date (t), with
  356. oldest files first (r). The output "window" is restricted to 50
  357. columns (X50), by 15 lines (Y 15).  A totalization of all entries is
  358. requested (T), and entries ending with the string "zoo" will be
  359. excluded (x*zoo).
  360.  
  361.  
  362.            ls -lN df0:emily.c -sOdf1:lynn.c df0:*.c
  363.  
  364.       This command prints a long format listing (l) of all files
  365. ending with the string ".c" on df0: that are newer than "df0:emily.c"
  366. (N df0:emily.c), but are older than "df1:lynn.c" (Odf1:lynn.c).
  367.       The listing will be sorted by size, with largest files first
  368.  (s).
  369.  
  370.  
  371.      NOTES
  372.       Wildcards:
  373.       ----------
  374.       Normal wildcards may be used in file names and in the last
  375.     level of a directory path name. The "*" character is used to
  376.     match any number of characters (including zero), and a "?"
  377.     matches any single character. Wildcards may also be used in
  378.     specifying an exclusion pattern (-x).
  379.  
  380.       If the shell that is used to invoke ls expands the wildcards
  381.     itself, they MUST be quoted in some manner for ls to work as
  382.     intended. Some common shell quoting methods are: "*" or \* or '*
  383.     See your shell documentation for details.
  384.  
  385.  
  386.       Options:
  387.       --------
  388.      Option flags may be given in any order. Where options conflict,
  389.      such as specifying both -s and -t, the last option encountered
  390.      is the one used.
  391.  
  392.       Option flags may be given grouped or seperately. E.g., "-lsR"
  393.     is logically the same as "-l -s -R".
  394.  
  395.       Options requiring an argument, such as -x or -B, must be the
  396.     last option in a group, or given seperately, and must be
  397.     immediately followed by the argument (with or without seperating
  398.     blanks). The forms:  "-ltB488",  "-ltB 488",  "-lt -B488", and
  399.     "-l -B   488 -t" are all correct, and logically the same. The
  400.     form "-lB488t" is NOT correct, and will result in unspecified
  401.     behavior.
  402.  
  403.      Options are normally reset to their default state between name
  404.      arguments. Some flags however, apply to all name arguments, and
  405.      are identified as "sticky" in the option descriptions above.
  406.  
  407.  
  408.       Pathnames:
  409.       ----------
  410.       A pathname with spaces in it like "Wombat Soup", must be
  411.     surrounded by quotes. Up to 30 seperate pathname patterns can be
  412.     processed by ls per command.
  413.  
  414.  
  415.       Aborting:
  416.       ---------
  417.       ls may be aborted at any time by issuing a control-C (assuming
  418.     the invoking shell passes ^C's along to the applications). ls
  419.     will print the string "**BREAK" and then terminate when this
  420.     occurs.
  421.  
  422.  
  423.       Formatted Output:
  424.       -----------------
  425.       For customized output, there is a special option that expects a
  426.       format rule as the next argument:
  427.  
  428.       -F <format>
  429.            Format output with <format), using the following symbols:
  430.           %p  print the attribute bits
  431.           %d  print the date: yy-mm-dd
  432.           %t  print the time: hh-mm-ss
  433.           %b  print the number of blocks used by the entry
  434.           %s  print the number of bytes  used by the entry
  435.           %n  print the name of the entry
  436.           %%  print a percent symbol
  437.           \n  print a linefeed
  438.           \t  print a tab
  439.           \\  print a backslash symbol
  440.  
  441.            The default format rule that ls uses for old format long
  442.            listings is:  -F "%p %d %t %4b %8s %n\n". Note that a
  443.            format specification that contains spaces must be quoted.
  444.  
  445.            Any of the format options that begin with the '%' symbol
  446.            can have an optional pad count that lets you specify how
  447.            many columns to use. For example:  -F "%40n\n" would print
  448.            each entry name right justified in a field of 40 columns.
  449.  
  450.            The attribute bits in this format are as described above,
  451.          with one exception: the first position is used to indicate
  452.          that the entry has an associated comment. If so, a "c" is
  453.          used (else a "-").
  454.  
  455.            You can use this feature of ls to help create simple batch
  456.            command files.  For example, the command:
  457.  
  458.           ls -PF "copy %n RAM:\n" df0:*.h
  459.  
  460.            tells ls to perform a listing using full pathnames with a
  461.            special format, matching only filenames that end with ".h"
  462.            in directory df0:. Suppose df0: has the following files in
  463.            it:
  464.  
  465.           joe.h  fred.h  pete.h  ted.h
  466.  
  467.            The example ls command would result in the following list
  468.            of commands:
  469.  
  470.           copy df0:fred.h RAM:
  471.           copy df0:joe.h RAM:
  472.           copy df0:pete.h RAM:
  473.           copy df0:ted.h RAM:
  474.  
  475.            A script file from this by redirecting the output of ls to
  476.            a temporary file:
  477.  
  478.           ls >ram:templist -PF "copy %n RAM:\n" df0:*.h
  479.           execute ram:templist    ; do the script,
  480.           delete ram:templist     ;    and delete it
  481.  
  482.  
  483.       Tip:
  484.       ----
  485.       To list files older or newer than a certain date, rather than a
  486.       certain file, you can do this:
  487.  
  488.          echo >RAM:datemark "Marker"    ; create a temp file in RAM:
  489.          setdate RAM:datemark 07-Jul-89 ; set datestamp for temp file
  490.          ls -N ram:datemark df0:        ; list files newer than
  491.                                          "datemark"
  492.            delete ram:datemark        ; remove temp file
  493.  
  494.  
  495.      CAVEATS/BUGS
  496.       Refer to the README file accompanying this distribution for
  497.     notes of any currently known bugs or limitations.
  498.  
  499.  
  500.      AUTHORS
  501.       Justin V. McCormick is the author of the of ls (v3.1), and
  502.      other earlier revisions. Version 3.1 was used as a base on which
  503.      to develop the current revision (v4.0k), because of its
  504.      excellent "inline" sorting and its columnation algorithms, as
  505.      well as its small size, and fast code.
  506.  
  507.       Kim E. DeVaughn provided the numerous enhancements, fixes, etc,
  508.       to bring v3.1 up to the current v4.0k.
  509.  
  510.  
  511.      COPYRIGHT
  512.       ls v4.0k is (c) Copyright 1990, Kim E. DeVaughn, all rights
  513.       reserved.  See the "License" accompanying this distribution for
  514.       limitations, and other details.
  515.  
  516.       UNIX is a registered trademark of AT&T.  They had nothing to do
  517.       with any of this code, but did provide the "model" for some of
  518.       its output formats and options.
  519.